import React,{Component} from 'react'
import PropTypes from 'prop-types'
class todoListItem extends Component{
	constructor(props){
	super(props)
	this.handleClickItem=this.handleClickItem.bind(this)
	}
	shouldComponentUpdate(nextProps,nextState){
		if(nextProps.content===this.props.content){
			return false
		}
		else{
			return true
		}
		
	}
	render(){
		const {content}=this.props
		return(
			<div onClick={this.handleClickItem}>{content}</div>
		)
	}
	handleClickItem(){
		const {index,itemDelete}=this.props
		console.log(index)
		itemDelete(index)
	}
}

todoListItem.propTypes={
	content:PropTypes.string,
	itemDelete:PropTypes.func,
	index:PropTypes.number
}
export default todoListItem;